package com.engine4cloud.tdf.supervision.convert;

import com.engine4cloud.tdf.common.core.constant.SupervisionBusinessConstants;
import com.engine4cloud.tdf.supervision.dto.result.HomeIndexCorrectorResultDTO;
import org.mapstruct.Mapper;
import org.mapstruct.factory.Mappers;

import java.util.Objects;


@Mapper
public interface HomeIndexCorrectorConvert {
    HomeIndexCorrectorConvert INSTANCE = Mappers.getMapper(HomeIndexCorrectorConvert.class);

    default HomeIndexCorrectorResultDTO convert(HomeIndexCorrectorResultDTO s) {
        if (Objects.isNull(s)) {
            return null;
        }

        HomeIndexCorrectorResultDTO result = new HomeIndexCorrectorResultDTO();
        result.setEnter(s.getEnter());
        result.setProcess(s.getProcess());
        result.setRelease(s.getRelease());
        result.setTotalReceive(s.getTotalReceive() + SupervisionBusinessConstants.HISTORY_TOTAL_PROCESS);
        result.setTotalRelease(s.getTotalRelease() + SupervisionBusinessConstants.HISTORY_TOTAL_PROCESS);
        return result;
    }

}
